// Avoid `console` errors in browsers that lack a console.
if (!(window.console && console.log)) {
    (function() {
        var noop = function() {};
        var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'markTimeline', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
        var length = methods.length;
        var console = window.console = {};
        while (length--) {
            console[methods[length]] = noop;
        }
    }());
}

// Place any jQuery/helper plugins in here.
/*
* jQuery Watermark Plugin
*   http://updatepanel.net/2009/04/17/jquery-watermark-plugin/
*
* Copyright (c) 2009 Ting Zwei Kuei
*
* Dual licensed under the MIT and GPL licenses.
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.opensource.org/licenses/gpl-3.0.html
*/
(function(jQuery) {
    jQuery.fn.updnWatermark = function(options) {
        options = jQuery.extend({}, jQuery.fn.updnWatermark.defaults, options);
        return this.each(function() {
            var jQueryinput = jQuery(this);
            var jQuerywatermark = jQueryinput.data("watermark");
            // only create watermark if title attribute exists
            if (!jQuerywatermark && this.title) {
                var jQuerywatermark = jQuery("<label/>")
                    .insertBefore(this)
                    .text(this.title)
                    .attr("for", this.id)
                    .addClass(options.cssClass)
                    .hide()
                    .bind("position", function() {
                        var pos = jQueryinput.position();
                        jQuery(this).css({
                            position: "absolute",
							zIndex:2,
                            left: pos.left,
                            top: pos.top
                        })
                    })
                    .bind("show", function() {
                        jQuery(this).fadeIn("fast");
                    })
                    .bind("hide", function() {
                        jQuery(this).hide();
                    })
                    .bind("update", function() {
                        (jQueryinput.is(":visible") ? jQuery(this).trigger("position").show() : jQuery(this).hide());
                    });
                jQueryinput.data("watermark", jQuerywatermark);
            }
            if (jQuerywatermark) {
                jQueryinput
                    .focus(function(ev) {
                        jQuerywatermark.trigger("hide");
                    })
                    .blur(function(ev) {
                        if (!jQuery(this).val()) {
                            jQuerywatermark.trigger("show");
                        }
                    });
                // set initial state
                if (!jQueryinput.val()) {
                    jQuerywatermark.trigger("position").show();
                }
            }
        });
    };
    jQuery.fn.updnWatermark.defaults = {
        cssClass: "updnWatermark"
    };
    jQuery.updnWatermark = {
        attachAll: function(options) {
            jQuery.updnWatermark.all = jQuery("input:text[title!=''],input:password[title!=''],textarea[title!='']").updnWatermark(options);
        },
        updateAll: function() {
            (jQuery.updnWatermark.all && jQuery.updnWatermark.all.each(function() {
                var jQuerywatermark = jQuery(this).data("watermark");
                (jQuerywatermark && jQuerywatermark.trigger("update"));
            }));
        }
    };
})(jQuery);